package com.gupao.gupaoeduvippattern.javaBase.thread.day02;

/**
 * @author Administrator
 * @date 2020-12-08 11:01
 */
public class Ticket {

    int sum = 10;

    public void buyTicket(){
        if(sum > 0){
            sum--;
            System.out.println(Thread.currentThread().getName() +"抢到票了，还剩余票数：" + sum);
        }else{
            System.out.println(Thread.currentThread().getName() +"没有票了！");
        }

    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }
}
